# 元素不重复.顺序不一定
s1 = {10, 40, 30}
print(s1)

s2 = {10, 40, 30, 30}
print(s1)

s3 = set('abcdefg')
print(s3)

s4 = set()
print(s4)
print(type(s4))

# 增加
s1.add(100)  # 单一数据
print(s1)
s1.update([10, 20, 50])  # 增加序列
print(s1)

# 删除
s1.remove(10)  # 不存在就报错
print(s1)
s1.discard(10)  # 不存在不报错
print(s1)
print(s1.pop())  # 随机删除一个

# 查找
print(40 in s1)
# 遍历
for i in s1:
    print(i)
